	<CFOUTPUT>
	<script language="JavaScript1.2" src="#client.common_path#CheckDate.js"></script>
	<script language="JavaScript1.2" src="#client.common_path#CheckDigit.js"></script>
	<script language="JavaScript1.2" src="#client.common_path#CheckValue.js"></script>
	</CFOUTPUT>

	<script>
	function PutValue(sValue) {
	<CFOUTPUT>
	var sFrmName="#frmName#"
	</CFOUTPUT>
		eval("document." + sFrmName + ".addtnlbutton.value='" + sValue + "'")
	}
	function FilterKeyup(oObject) {
	var sColumnType

		<CFOUTPUT>
		sColumnType=document.#frmName#.cmbSort.options[document.#frmName#.cmbSort.selectedIndex].columntype
		</CFOUTPUT>

		if (sColumnType == "ftdatetime")
			CheckDigit("0123456789/", oObject)
		else
			if (sColumnType == "ftfloat" || sColumnType == "ftint")
				CheckDigit("0123456789.", oObject)
	}
	function FilterOnBlur(oObject) {
	var sColumnType

		if (oObject.value != "") {
			<CFOUTPUT>
			sColumnType=document.#frmName#.cmbSort.options[document.#frmName#.cmbSort.selectedIndex].columntype
			</CFOUTPUT>

			if (sColumnType == "ftdatetime") {
				if (oObject.value != "" && !CheckDate(oObject)) {
					alert("Filter value is not a valid date")
					oObject.value=""
					oObject.focus()
				}
			} else {
				if ( (sColumnType == "ftfloat" || sColumnType == "ftinteger" || sColumnType == "ftsmallint") &&
					 oObject.value != "") {
					CheckValue(oObject, "", "Y")
					if (oObject.value == "") {
						alert("Filter value is not a valid number")
						oObject.focus()
					}
				}
			}
		}
	}
	</script>

	<!---NOTE! (must set first before including this to a file) 
		parameters
		frmName - name of the form (required)
		lstAddtnlButton - additional button (optional), a list within a list, every button is
			separated by comma and each property is separated by ~
			syntax:  button_name~button_value~hint~width(optional), ...
			e.g. adduser~Add iBOS/e User~Add new user, ...
		lstOrder - for ordering, a list within a list, every button is
			separated by comma and each property is separated by ~ (required)
			syntax:  field_desc~fieldname~fieldtype~alias(optional), etc.
			
			e.g. EMPSTATUS~Employment Status~ftstring~A, ...
	--->
	<!--- toolbar extension --->
	<CFPARAM NAME="toolextend" DEFAULT="&nbsp;">

	<!--- Set the default number of records to display on each page. --->
	<CFPARAM NAME="nOnEachPage" DEFAULT="20">

	<!--- Set the default list of additional button --->
	<CFPARAM NAME="lstAddtnlButton" DEFAULT="">

	<!--- Set constant for Additional Button --->
	<CFSET cBTNNAME=1> <!--- button name --->
	<CFSET cBTNVALUE=2> <!--- button value --->
	<CFSET cBTNHINT=3> <!--- button hint --->
	<CFSET cBTNWIDTH=4> <!--- button width --->
	<CFSET cBTNDISABLE=5> <!--- button disable --->
	<CFSET cBTNONCLICK=6> <!--- button OnClick Event --->
	<CFSET cDELIMITER1=",">
	<CFSET cDELIMITER2="~">

	<!--- Set constant for Order --->
	<CFSET cORDERDESC=1> <!--- Order Description --->
	<CFSET cORDERFN=2> <!--- Order Fieldname --->
	<CFSET cORDERTYPE=3> <!--- Order Columntype --->
	<CFSET cORDERALIAS=4> <!--- Order Alias(optional) --->

	<!--- Count starting row --->
	<CFIF isDefined("Form.First")>
		<CFSET nStartrow = 1>
	<CFELSEIF isDefined("Form.Prior")>
		<CFSET nStartrow = (form.startrow - nOnEachPage)>
	<CFELSEIF isDefined("Form.Next")>
		<CFSET nStartrow = (form.startrow + nOnEachPage)>
	<CFELSEIF isDefined("Form.Last")>
		<CFSET nStartrow = (QueryView.RecordCount - (QueryView.RecordCount MOD nOnEachPage)) + 1>
	<CFELSEIF isDefined("Form.Refresh")>
		<CFSET nStartrow = form.startrow>
	<CFELSEIF isDefined("url.startrow")>
		<CFSET nStartrow = url.startrow>
	<CFELSE>
		<CFSET nStartrow = 1>
	</CFIF>

	<CFSET nEndrow = nStartrow + nOnEachPage - 1>
	<!--- Validate starting and end row --->
	<CFIF QueryView.RecordCount>
		<CFIF nStartrow GT QueryView.RecordCount>
			<CFIF QueryView.RecordCount MOD nOnEachPage IS 0>
				<CFSET nStartrow = (QueryView.RecordCount - nOnEachPage) + 1>
			<CFELSE>
				<CFSET nStartrow = (QueryView.RecordCount - (QueryView.RecordCount MOD nOnEachPage)) + 1>
			</CFIF>
		</CFIF>

		<CFIF nEndrow GT QueryView.RecordCount>
			<CFSET nEndrow = QueryView.RecordCount>
		</CFIF>
	<CFELSE>
		<CFSET nStartrow = 0>
		<CFSET nEndrow = 0>
	</CFIF>
	<!--- Check sorting order --->
	<CFIF IsDefined("form.ascdesc")>
		<CFIF form.ascdesc IS "ASC">
			<CFSET sAscending="selected">
			<CFSET sDescending="">
		<CFELSE>
			<CFSET sAscending="">
			<CFSET sDescending="selected">
		</CFIF>
	<CFELSE>
		<CFSET sAscending="selected">
		<CFSET sDescending="">
	</CFIF>
	<!--- Check if first navigation button should be disabled --->
	<CFIF nStartrow IS 1 OR nStartrow IS 0>
		<CFSET lNoFirst="Yes">
	<CFELSE>
		<CFSET lNoFirst="No">
	</CFIF>
	<!--- Check if last navigation button should be disabled --->
	<CFIF nEndrow IS QueryView.RecordCount>
		<CFSET lNoLast="Yes">
	<CFELSE>
		<CFSET lNoLast="No">
	</CFIF>

	<CFOUTPUT>
	<input type="hidden" name="startrow" value="#nStartrow#">
	<table border=0 cellspacing=0 cellpadding=3 bgcolor="#client.color_grphead#" style="width:100%; height:2px;">
	</CFOUTPUT>
	<tr>
		<td nowrap valign="middle">
			&nbsp;
		<!--- Put additional fields --->
		<CFLOOP LIST="#lstAddtnlButton#" INDEX="addtnlbutton" DELIMITERS="#cDELIMITER1#">
			<CFOUTPUT>
				<input type="submit" <CFIF ListLen(#addtnlbutton#, cDELIMITER2) GTE cBTNWIDTH><CFIF ListGetAt(addtnlbutton, cBTNWIDTH, cDELIMITER2) NEQ "-1">style="width: #ListGetAt(addtnlbutton, cBTNWIDTH, cDELIMITER2)#px"</CFIF></CFIF> name="#ListGetAt(addtnlbutton, cBTNNAME, cDELIMITER2)#" value="#ListGetAt(addtnlbutton, cBTNVALUE, cDELIMITER2)#" class="bitbtn" title="#ListGetAt(addtnlbutton, cBTNHINT, cDELIMITER2)#"  <CFIF ListLen(#addtnlbutton#, cDELIMITER2) GTE cBTNONCLICK>ONCLICK="return #ListGetAt(addtnlbutton, cBTNONCLICK, cDELIMITER2)#;"</CFIF> <CFIF ListLen(#addtnlbutton#, cDELIMITER2) GTE cBTNDISABLE>#ListGetAt(addtnlbutton, cBTNDISABLE, cDELIMITER2)#</CFIF>>
			</CFOUTPUT>
		</CFLOOP>
		<CFOUTPUT>
			&nbsp;
			<CFIF lNoFirst>
				<input disabled type="submit" class="bitbtn" name="First" value="&nbsp;|<&nbsp;">
				<input disabled type="submit" class="bitbtn" name="Prior" value="&nbsp;<&nbsp;">
			<CFELSE>
				<input type="submit" class="bitbtn" name="First" value="&nbsp;|<&nbsp;" title="First Recordset">
				<input type="submit" class="bitbtn" name="Prior" value="&nbsp;<&nbsp;" title="Previous Recordset">
			</CFIF>
			<CFIF lNoLast>
				<input disabled type="submit" class="bitbtn" name="Next" value="&nbsp;>&nbsp;">
				<input disabled type="submit" class="bitbtn" name="Last" value="&nbsp;>|&nbsp;">
			<CFELSE>
				<input type="submit" class="bitbtn" name="Next" value="&nbsp;>&nbsp;" title="Next Recordset">
				<input type="submit" class="bitbtn" name="Last" value="&nbsp;>|&nbsp;" title="Last Recordset">
			</CFIF>
			&nbsp;
			<input type="submit" class="bitbtn" name="Refresh" value="Refresh and Clear Filter" title="Refresh Recordset">
		</CFOUTPUT>
		</td>
		<CFOUTPUT>
		<td valign="middle" class="white" NOWRAP width="100%">#toolextend#</td>
		</CFOUTPUT>
		<td valign="middle" class="white" NOWRAP>
			&nbsp;&nbsp;&nbsp;
			<!--- for sorting records --->
			<CFOUTPUT>
             Field Name:&nbsp;
			<select name="cmbSort" size="1" class="bitbtn" onchange="document.#frmName#.edtValFilter.value=''">
			</CFOUTPUT>
			<CFLOOP LIST="#lstOrder#" INDEX="order">
				<CFSET sColumnType=LCase(ListGetAt("#order#", cORDERTYPE, "~"))>

				<CFIF sColumnType IS "ftstring" OR sColumnType IS "ftdatetime" OR
					  sColumnType IS "ftfloat" OR sColumnType IS "ftcombo" OR sColumnType IS "ftint">
					<CFSET sColumnName=ListGetAt("#order#", cORDERFN, "~")>

					<CFIF ListLen(#order#, "~") IS 4>
						<CFSET sColumnName=ListGetAt("#order#", cORDERALIAS, "~") & "." & sColumnName>
					</CFIF>

					<CFIF IsDefined("form.cmbsort") AND sColumnName IS form.cmbsort>
						<CFSET sSelected="selected">
					<CFELSE>
						<CFSET sSelected="">
					</CFIF>

					<CFOUTPUT>
					<option #sSelected# value="#sColumnName#" columntype="#sColumnType#">&nbsp;#ListGetAt("#order#", cORDERDESC, "~")#</option>
					</CFOUTPUT>
				</CFIF>
			</CFLOOP>
			</select>&nbsp;
		</td>

		<td valign="middle" class="white" NOWRAP>
        Order:&nbsp;
			<select name="ascdesc" size="1" class="bitbtn">
				<CFOUTPUT>
				<option #sAscending# value="ASC">&nbsp;Ascending</option>
				<option #sDescending# value="DESC">&nbsp;Descending</option>
				</CFOUTPUT>
			</select>&nbsp;
		</td>


		<!--- for filtering records --->
		<td nowrap valign="middle" class="white">
			<CFIF IsDefined("form.edtValFilter")>
				<CFSET sEditFilterValue=form.edtValFilter>
			<CFELSE>
				<CFSET sEditFilterValue="">
			</CFIF>
			<CFOUTPUT>
			<!---#sEditFilterValue#--->
            Value:&nbsp;
			<INPUT TYPE="hidden" NAME="cmbFilter" VALUE="">
			<INPUT TYPE="text" NAME="edtValFilter" SIZE="8" CLASS="toolbar" VALUE="Filter Value"
			onfocus="if (this.value == 'Filter Value') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Filter Value';}"
			onSubmit="if (this.value == 'Filter Value') {this.value = '';}">
			</CFOUTPUT>
		</td>
		<td valign="middle">
		<CFOUTPUT>
			&nbsp;&nbsp;<input type="submit" title="Apply Filter/Sort" name="Filter" class="bitbtn" width="50px">&nbsp;
		</CFOUTPUT>
		</TD>
	</tr>
	</table>
	